Alterative sysprof build support
authorMatthias Clasen <mclasen@redhat.com>
Fri, 21 Aug 2020 22:28:29 +0000 (18:28 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 21 Aug 2020 22:28:29 +0000 (18:28 -0400)
Don't link libgtk against libsysprof. We only
need that for the test-performance binary.

gdk/meson.build
meson.build
tests/meson.build
testsuite/performance/meson.build

index 76d60dd2e683c8ee681ac6582e16a4e04836889b..9bb679160a6fe1e7c3df3854904a3e81198cd0dd 100644 (file)
@@ -194,8 +194,8 @@ gdk_deps = [
 ]
 
 if profiler_enabled
-  if profiler_dep.found()
-    gdk_deps += [profiler_dep]
+  if libsysprof_capture_dep.found()
+    gdk_deps += [libsysprof_capture_dep]
   endif
 endif
 
index 5884b259e9cb9cf5fb06085b1ef6bfd9f556edb4..bf8d515bbbeebd6c0d975565889352500c7f7bce 100644 (file)
@@ -439,7 +439,7 @@ endif
 
 cairo_libs = []
 if cc.get_id() == 'msvc'
-  # Fallback depedency discovery for those on Visual Studio that do not generate
+  # Fallback dependency discovery for those on Visual Studio that do not generate
   # pkg-config files in their build systems for MSVC
   # Fallback for Cairo
   if not cairo_dep.found()
@@ -703,39 +703,38 @@ endif
 
 profiler_enabled = get_option('profiler')
 if profiler_enabled
-  # Depend on libsysprof-capture if we only need the capture format.
-  # For -Dbuild-tests=true, we need SysprofProfiler to profile processes
-  # which requires sysprof-4 instead of sysprof-capture-4.
-
-  profiler_options = [
-    'enable_examples=false',
-    'enable_gtk=false',
-    'enable_tests=false',
-    'enable_tools=false',
-    'with_sysprofd=none',
-    'help=false',
-  ]
-
-  if get_option('build-tests')
-    profiler_dep_name = 'sysprof-4'
-    profiler_fallback = 'libsysprof_dep'
-  else
-    profiler_dep_name = 'sysprof-capture-4'
-    profiler_fallback = 'libsysprof_capture_dep'
-    profiler_options += ['libsysprof=false']
-  endif
-
-  profiler_dep = dependency(profiler_dep_name,
+  # libsysprof-capture support
+  libsysprof_capture_dep = dependency('sysprof-capture-4',
     required: true,
-    default_options: profiler_options,
-    fallback: ['sysprof', profiler_fallback],
+    default_options: [
+      'enable_examples=false',
+      'enable_gtk=false',
+      'enable_tests=false',
+      'enable_tools=false',
+      'libsysprof=true',
+      'with_sysprofd=none',
+      'help=false',
+    ],
+    fallback: ['sysprof', 'libsysprof_capture_dep'],
   )
-
-  if profiler_dep.found()
-    cdata.set('HAVE_SYSPROF', profiler_dep.found())
+  if libsysprof_capture_dep.found()
+    cdata.set('HAVE_SYSPROF', 1)
   else
     error('Profiler support not found, but was explicitly requested.')
   endif
+  libsysprof_dep = dependency('sysprof-4',
+    required: false,
+    default_options: [
+      'enable_examples=false',
+      'enable_gtk=false',
+      'enable_tests=false',
+      'enable_tools=false',
+      'libsysprof=true',
+      'with_sysprofd=none',
+      'help=false',
+    ],
+    fallback: ['sysprof', 'libsysprof_dep'],
+  )
 endif
 
 graphene_dep_type = graphene_dep.type_name()
index fd5fd6905d19462b39bb1f631a02ad65e8e41014..e80044569aa812266c2d17b2209cdb525b6e3284 100644 (file)
@@ -136,9 +136,9 @@ foreach t: gtk_tests
              dependencies: [libgtk_dep, libm])
 endforeach
 
-if get_option('profiler')
+if profiler_enabled
   executable('testperf', 'testperf.c',
-              dependencies: [profiler_dep, platform_gio_dep, libm])
+              dependencies: [libsysprof_dep, platform_gio_dep, libm])
 endif
 
 librsvg = dependency('librsvg-2.0', version: '>= 2.46.0', required: false)
index e28207686c58d8042c51933f474508c2cbdf24a5..33313923e8ebc70b2da99243ea2b44ba817338fd 100644 (file)
@@ -1,5 +1,7 @@
-if get_option ('profiler')
-  test_performance = executable('test-performance', 'test-performance.c',
-                                c_args: common_cflags,
-                                dependencies: [profiler_dep, platform_gio_dep, libm])
+if profiler_enabled
+  if libsysprof_dep.found()
+    test_performance = executable('test-performance', 'test-performance.c',
+                                  c_args: common_cflags,
+                                  dependencies: [libsysprof_dep, platform_gio_dep, libm])
+  endif
 endif